#ifndef __can_driver_H_
#define __can_driver_H_


#define CANFD_1500K	1500000
#define CAN_1000K	1000000
#define CAN_500K	500000
#define CAN_125K	125000
#define CAN_100K	100000
#define CAN_50K		50000



enum
{
	CAN_1,
	CAN_2,
	CAN_NODE_MAX,
};

typedef struct
{
  u32 StdId;
  u32 ExtId;
  u8 IDE;
  u8 RTR;
  u8 DLC;
  u8 Data[8];
  u8 FMI;
} CAN_MSG_T;

#define CAN_TYPE_STD	0
#define CAN_TYPE_EXT	1

#define CAN_FIFO_0		0
#define CAN_FIFO_1		1

#define CAN_FilterMode_Mask	0
#define CAN_FilterMode_List	1



#define CAN_RTR_TYPE_DATA 	0
#define CAN_RTR_TYPE_REMOTE	1



typedef struct CanDevice_S
{
	void (*RxProcessFunc)(const CAN_MSG_T* fram);
	u32 u16Baudrate;
	u8 Remap;
}CanDevice_s;



void CAN_filter_bank_init32bit(u8 bank, u8 FIFOx,u8 mode,u8 rtr, u32 id1, u32 id2);
void CAN_filter_bank_init16bit(u8 bank, u8 FIFOx,u8 mode,u8 rtr,u32 id1, u32 id2, u32 id3, u32 id4);

CanDevice_s * CAN_apply_device(u8 CANx);
void CAN_delete_device(u8 CANx);
u8 CAN_init_device(u8 CANx);

u8 CAN_data_send(u8 CANx,const CAN_MSG_T* CanMsg);





#endif


